package vip.xiaonuo.smzq.modular.psba.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.psba.entity.PsbaGtYfjbqk;
import vip.xiaonuo.smzq.modular.psba.entity.param.PsbaYfxqParam;
import vip.xiaonuo.smzq.modular.psba.entity.vo.PsbaYfxqVo;
import vip.xiaonuo.smzq.modular.psba.service.IPsbaGtYfjbqkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 评审备案-压覆基本情况
 *
 * @author Kevin
 * @since 2024-05-15
 */
@Api(tags = "评审备案-压覆基本情况")
@RestController
@RequestMapping("/psba/psbaGtYfjbqk")
@Validated
public class PsbaGtYfjbqkController {

    @Resource
    private IPsbaGtYfjbqkService iPsbaGtYfjbqkService;

    /**
     * 添加评审备案-压覆基本情况
     */
    @ApiOperation("添加评审备案-压覆基本情况")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid PsbaGtYfjbqk psbaGtYfjbqk) {
        iPsbaGtYfjbqkService.save(psbaGtYfjbqk);
        return CommonResult.ok();
    }

    /**
     * 删除评审备案-压覆基本情况
     */
    @ApiOperation("删除评审备案-压覆基本情况")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iPsbaGtYfjbqkService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑评审备案-压覆基本情况
     */
    @ApiOperation("编辑评审备案-压覆基本情况")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid PsbaGtYfjbqk psbaGtYfjbqk) {
        iPsbaGtYfjbqkService.updateById(psbaGtYfjbqk);
        return CommonResult.ok();
    }

    /**
     * 评审备案-压覆基本情况分页查询
     */
    @ApiOperation("评审备案-压覆基本情况分页查询")
    @GetMapping("/list")
    public CommonResult<Page<PsbaGtYfjbqk>> page(
            @ApiParam(name = "current", value = "页数", example = "1", required = true)  @RequestParam long current,
            @ApiParam(name = "size", value = "每页数量", example = "20", required = true) @RequestParam long size,
            String nd,String xzqhdm
    ) {
        return CommonResult.data(iPsbaGtYfjbqkService.page(current,size,nd,xzqhdm));
    }


    /**
     * 评审备案-压覆基本情况查询详情
     */
    @ApiOperation("评审备案-压覆基本情况查询详情")
    @GetMapping("/getPsbaGtYfjbqk")
    public CommonResult<PsbaGtYfjbqk> getPsbaGtYfjbqk(
            @ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh
    ) {
        return CommonResult.data(iPsbaGtYfjbqkService.getPsbaGtYfjbqk(psbabh));
    }

    /**
     * 评审备案-压覆基本情况查询相关详情
     */
    @ApiOperation("评审备案-压覆基本情况查询相关详情")
    @GetMapping("/getPsbaYfxqVo")
    public CommonResult<PsbaYfxqVo> getPsbaYfxqVo(
            @ApiParam(name = "psbabh", value = "评审备案编号") @RequestParam String psbabh
    ) {
        return CommonResult.data(iPsbaGtYfjbqkService.getPsbaYfxqVo(psbabh));
    }



    /**
     * 添加压覆基本情况
     */
    @ApiOperation("添加压覆基本情况")
    @PostMapping("/insertPsbaYfxqVo")
    public CommonResult<String> insertPsbaYfxqVo(@RequestBody @Valid PsbaYfxqParam psbaYfxqVo) {
        iPsbaGtYfjbqkService.insertPsbaYfxqVo(psbaYfxqVo);
        return CommonResult.ok();
    }




}
